@layout("/common/_container.html"){
<meta http-equiv="Content-Type" content="multipart/form-data; charset=utf-8"/>
<div class="ibox float-e-margins">
    <div class="ibox-content">
        <div class="form-horizontal" id="userInfoForm">
            <form class="m-t" role="form" enctype="multipart/form-data" action="${ctxPath}/recharge/upload" method="post">
                <div class="row">
                    <input type="file" id="files" name="file">
                    <!--<#button name="获取模板" icon="fa-plus" clickFun="TestQuestionsInfoDlg.downLoadExcel()"/>-->
                </div>
                <div class="row">
                    <input class="btn btn-white dropdown-toggle" id="sure" icon="fa-check" type="submit" value="收费明细批量上传">
                    <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser"
                            clickFun="parent.layer.close(parent.layer.getFrameIndex(window.name))"/>
                </div>
            </form>
            <!--<#button btnCss="info" name="导入" id="submit_import" icon="fa-check" />-->
            <!--<#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="TestQuestionsInfoDlg.close()"/>-->
        </div>
    </div>
</div>
<script src="${ctxPath}/static/modular/arrival/customer/customer_info.js"></script>

<script>
    //    document.getElementById('productImg').value =""
    //点击导入按钮,使files触发点击事件,然后完成读取文件的操作
    $("#fileImport").click(function () {
        $("#files").click();
    })

    function fileImport() {
        //获取读取我文件的File对象
        var selectedFile = document.getElementById('files').files[0];
        var name = selectedFile.name;//读取选中文件的文件名
        var size = selectedFile.size;//读取选中文件的大小
        document.getElementById('fileImport_text').value = name;
        var reader = new FileReader();//这是核心,读取操作就是由它完成.
//         reader.readAsText(selectedFile);//读取文件的内容,也可以读取文件的URL
        reader.onload = function () {
            //当读取完成后回调这个函数,然后此时文件的内容存储到了result中,直接操作即可
            console.log(this.result);
        }
    }

    $('#submit_import').click(function () {
        var selectedFile = document.getElementById('files').files[0];
        var files = $("#files").val();
        $.ajax({
            url: Feng.ctxPath +"/recharge/upload",
            type: "post",
            data: {
                "file": files
            },
            success: function (data) {
                alert('成功!');
            },
            error: function (data) {
                alert('请稍后再试!');
            }
        });
    })
</script>
@}
